package cn.ccew.sys.web;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.util.WebUtils;

import cn.ccew.common.base.controller.BaseController;
import cn.ccew.sys.model.SysPersonnel;
import cn.ccew.sys.web.login.LoginController;

@RequestMapping("/sys")
public class SysBaseController extends BaseController {

	/**
	 * 获取当前登录对象
	 * 
	 * @param request
	 * @return
	 * @throws Exception
	 */
	protected SysPersonnel getCurrAdmin(HttpServletRequest request) throws Exception {

		SysPersonnel admin = null;
		admin = (SysPersonnel) WebUtils.getSessionAttribute(request, LoginController.curr_user_key);
		if (null != admin) {
			admin = baseService.findById(admin.getId(), SysPersonnel.class);
		}

		return admin;

	}

}
